use std::cmp::*;
use std::collections::*;
use std::io::*;

fn main() {
    let stdin = stdin();
    let mut lines = stdin.lock().lines().map(|line| line.unwrap());

    let v: Vec<usize> = lines
        .next()
        .unwrap()
        .split_whitespace()
        .map(|s| s.parse().unwrap())
        .collect();

    let (n, k) = (v[0], v[1]);

    let a: Vec<i128> = lines
        .next()
        .unwrap()
        .split_whitespace()
        .map(|s| s.parse().unwrap())
        .collect();

    let b: Vec<i128> = lines
        .next()
        .unwrap()
        .split_whitespace()
        .map(|s| s.parse().unwrap())
        .collect();

    let mut v: Vec<(i128, i128)> = Vec::new();

    for i in 0..n {
        v.push((b[i], a[i]));
    }

    v.sort_by(|a, b| b.cmp(a));

    let mut res = 0;
    let mut sum = 0;
    let mut min_heap = BinaryHeap::new();

    for i in 0..n {
        let min_comment = v[i].0;
        sum += v[i].1;
        min_heap.push(Reverse(v[i].1));

        if min_heap.len() > k {
            sum -= min_heap.pop().unwrap().0;
        }

        if min_heap.len() == k as usize {
            res = max(res, sum * min_comment);
        }
    }

    print!("{}", res);
}
